# 地址：http://121.40.86.4:8899/admin/login
# 账号：admin
# 密码：Aa010903!
# 用例一：
# 1、用户登录
# 2、点击用户
# 3、点击用户分组
# 4、添加用户分组
# 5、判断添加是否成功
# 6、删除用户分组
# 7、判断删除是否是成功的
# import time
# from selenium import webdriver
# from selenium.webdriver.common.by import By
# from selenium.webdriver.support.ui import WebDriverWait #强制等待
# from selenium.webdriver.support import expected_conditions as EC   #找不到问题抛出异常
# deiver = webdriver.Chrome()
# #打开网页
# deiver.get("http://121.40.86.4:8899/admin/login")
# #全屏
# deiver.maximize_window()
# deiver.implicitly_wait(15)
# #输入用户名和密码
# deiver.find_elements(By.CLASS_NAME,"el-input__inner")[0].send_keys("admin")
# deiver.find_elements(By.CLASS_NAME,"el-input__inner")[1].send_keys("Aa010903!")
# #点击登录
# deiver.find_element(By.CLASS_NAME,"el-button").click()
# time.sleep(2)
# #点击用户
# deiver.find_elements(By.CLASS_NAME,"font12")[1].click()
# time.sleep(2)
# #点击用户分组
# deiver.find_elements(By.CLASS_NAME,"el-menu-item")[1].click()
# time.sleep(2)
#点击添加用户分组
# deiver.find_element(By.CLASS_NAME,"el-button").click()
# time.sleep(2)
#输入
# deiver.find_elements(By.CLASS_NAME,"el-input__inner")[2].send_keys("张鑫")
# time.sleep(2)
#确定
# deiver.find_elements(By.CLASS_NAME,"el-button")[2].click()
# time.sleep(2)
#测试
# text = deiver.find_element(By.XPATH,"//*[@id='app']/section/div[2]/section/div/div[1]/div/main/div/div[1]/div/div[1]/div/div/div/div[2]/div[3]/table/tbody/tr[5]/td[2]/div/span").text
# assert text == "张鑫"
# time.sleep(3)
#删除
# deiver.find_element(By.CSS_SELECTOR,"/html/body/div/section/div[2]/section/div/div[1]/div/main/div/div[1]/div/div[1]/div/div/div/div[2]/div[4]/div[2]/table/tbody/tr[3]/td[3]/div/a[2]").click()
# time.sleep(2)
# deiver.find_elements(By.CLASS_NAME,"el-button")[2].click()
# time.sleep(2)





# 用例二：
# 1、登录
# 2、点击客服
# 3、客服话术
# 4、新增客服话术
# 5、看新增是否是成功的
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait #强制等待
from selenium.webdriver.support import expected_conditions as EC   #找不到问题抛出异常
deiver = webdriver.Chrome()
#打开网页
deiver.get("http://121.40.86.4:8899/admin/login")
#全屏
deiver.maximize_window()
deiver.implicitly_wait(15)
#输入用户名和密码
deiver.find_elements(By.CLASS_NAME,"el-input__inner")[0].send_keys("admin")
deiver.find_elements(By.CLASS_NAME,"el-input__inner")[1].send_keys("Aa010903!")
#点击登录
deiver.find_element(By.CLASS_NAME,"el-button").click()
time.sleep(2)
deiver.find_elements(By.CLASS_NAME,"layout-columns")[6].click()
time.sleep(2)
#
deiver.find_elements(By.CLASS_NAME,"el-menu-item")[1].click()
time.sleep(2)
#添加话术
# deiver.find_element(By.CLASS_NAME,"el-button").click()
# time.sleep(2)
#
# deiver.find_elements(By.CLASS_NAME,"el-textarea__inner")[0].send_keys("您好")
# time.sleep(1)
# deiver.find_elements(By.CLASS_NAME,"el-textarea__inner")[1].send_keys("您好")
# time.sleep(1)
# deiver.find_elements(By.CLASS_NAME,"el-button")[2].click()
# time.sleep(2)
deiver.find_elements(By.CLASS_NAME,"number")[1].click()
time.sleep(2)
text = deiver.find_element(By.XPATH,"//*[@id='app']/section/div[2]/section/div/div[1]/div/main/div/div[1]/div/div[1]/div/div/div[2]/div/div/div[2]/div[3]/table/tbody/tr[12]/td[6]/div/span").text
assert text == "2025-05-12 11:56:12"
time.sleep(3)


